package com.meeting.model.enums;

/**
 * 支付记录状态枚举
 */
public enum PaymentStatusEnum {
    PENDING_PAYMENT(0, "待支付"),
    SUCCESS(1, "成功"),
    FAILED(2, "失败"),
    REFUNDED(3, "已退款");

    private final int code;
    private final String description;

    PaymentStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static PaymentStatusEnum fromCode(int code) {
        for (PaymentStatusEnum status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid OrderStatus code: " + code);
    }
}